package Notifications;

import java.text.SimpleDateFormat;

public class DateUtility {
	
	
 public java.sql.Date getUserSqlDate(String startDate){
		
	java.sql.Date sqlStartDate = null;
	try{
		if(null != startDate && startDate.contains("/")){
			String array[] = startDate.split("/");
	        String date1 = array[1]+"/"+array[0]+"/"+array[2];
	        SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); 
	        java.util.Date dt = formatter.parse(date1);
	        sqlStartDate=new java.sql.Date(dt.getTime());
			}
		}catch(Exception e){
			e.printStackTrace();
		}
	return sqlStartDate;
 }
 
 public String DateFormatTest(String date) 
 {
	  String converted_date = "";
	  try{
	  converted_date = converted_date + date.substring(date.lastIndexOf('/')+1,date.length()); 
	  converted_date= converted_date +"-"+date.substring(0,date.indexOf('/')); 
	  converted_date = converted_date+"-"+date.substring(date.indexOf('/')+1,date.lastIndexOf('/'));
 
 System.out.print(converted_date); 
 }catch(Exception e){
	  e.printStackTrace();
 }
 return converted_date;
 
} 
	
}
